package org.xqp.hrm.feign.client;


import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.xqp.hrm.doc.CourseDoc;
import org.xqp.hrm.util.AjaxResult;

@Component
@Slf4j
public class CourseESFeignClientFallbackFactory implements FallbackFactory<CourseESFeignClient> {

    @Override
    public CourseESFeignClient create(Throwable throwable) {
        return new CourseESFeignClient(){

            @Override
            public AjaxResult save(CourseDoc doc) {
                log.error("服务降级啦 {}",throwable.getMessage() );
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("系统繁忙");
            }
        };
    }
}
